package com.atguigu.java8.datetime;

import org.junit.Test;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Set;

public class TestZoneDateTime {

    @Test
    public void test1() {
        Set<String> availableZoneIds = ZoneId.getAvailableZoneIds();
        availableZoneIds.forEach(System.out::println);
    }

    @Test
    public void test2() {
        // ZonedDateTime
        LocalDateTime now = LocalDateTime.now(ZoneId.of("Europe/Tallinn"));
        System.out.println(now);

        LocalDateTime now1 = LocalDateTime.now(ZoneId.of("Europe/Tallinn"));
        ZonedDateTime zonedDateTime = now1.atZone(ZoneId.of("Europe/Tallinn"));
        System.out.println(zonedDateTime);

        now1 = LocalDateTime.now(ZoneId.of("Asia/Shanghai"));
        zonedDateTime = now1.atZone(ZoneId.of("Asia/Shanghai"));
        System.out.println(zonedDateTime);
    }

}
